home *** CD-ROM | disk | FTP | other *** search
- /*
- * This file is not to be maintained by ProjectBuilder!
- *
- * Application: NPoff
- *
- * Purpose: To power down an attached NeXT laser printer.
- *
- * Author: Christopher Rath crath@bnr.ca (613) 824-4584
- * Box 15781, Station 'F'
- * Ottawa, ON CANADA
- * K1C 3S7
- *
- * Version: 1.0
- *
- * Written: 18 March, 1994
- *
- * Bugs: Doesn't advertise itself as a service.
- *
- * Copyright: None.
- * Released to the public domain.
- */
-
- #import <appkit/appkit.h>
- #import <errno.h>
- #import <string.h>
- #import <sys/file.h>
-
-
- /*
- * Contants:
- *
- * NPPOWER - The UNIX command used to control power to the NeXT printer.
- * OFF - The parameter to pass to NPPOWER to turn off the printer.
- * ON - The parameter to pass to NPPOWER to turn on the printer.
- */
- #define NPPOWER "/usr/etc/nppower"
- #define OFF "off"
- #define ON "on"
-
-
- void main(int argc, char *argv[])
- {
- [Application new];
-
- if (access(NPPOWER, F_OK | X_OK))
- {
- /*
- * Some Error occured, put up an alert box informing the user.
- */
- NXRunAlertPanel([NXApp appName],
- "Unable to execute %s to power down the NeXT printer: %s (%d).",
- "Cancel", NULL, NULL,
- NPPOWER, strerror(errno), errno);
- }
- else
- {
- /*
- * Access() says we can execute NPPOWER, so let's do it.
- */
- system(NPPOWER " " OFF);
- }
-
- [NXApp free];
- exit(0);
- }
-